#ifndef SKYID_MUSIC_H 
#define SKYID_MUSIC_H

#include <AL/al.h>
#include <AL/alc.h>
#include <ogg/ogg.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>

#include "common.h"
#include "reader.h"
#include "sound.h"

#define OGG_BUFFER_SIZE    0x4000
#define OGG_BUFFERS_COUNT  2

namespace SkyID 
{

//- Music ---------------------------------------------------------------------

class Music : public Sound
{
public:
	Music();
	virtual ~Music();

	virtual bool update();

protected:
	virtual bool fillBuffer(ALuint buffer) { return false; }
	virtual void cleanBuffer();

protected:
	Reader *mReader;
};

//- MusicOGG ------------------------------------------------------------------

class MusicOGG : public Music
{
public:
	MusicOGG(Reader *reader);
	virtual ~MusicOGG();

	virtual void play();

protected:
	bool open(Reader *reader);
	bool fillBuffer(ALuint buffer);

private:
	OggVorbis_File mOggStream;
};

} // namespace SkyID

#endif // SKYID_MUSIC_H
